public class Login {

    public String userName = "admin";
    public String passWord = "123456";

    public void loginInfo(String userName,String passWord)
        throws PassWordException,UserNameException{
        if(!this.userName.equals(userName)){
//            System.out.println("用户名错误...");
//            return ;
            throw new UserNameException("用户名异常错误...");

        }if(!this.passWord.equals(passWord)){
//            System.out.println("密码错误...");
//            return ;
            throw new PassWordException("密码错误异常...");
        }
        System.out.println("登录成功！");
    }

    public static void main(String[] args) {
        Login login = new Login();
        try {
            login.loginInfo("admin","123456");
        } catch (PassWordException e) {
            e.printStackTrace();
            System.out.println("PassWordException...");
        } catch (UserNameException e) {
            e.printStackTrace();
            System.out.println("UserNameException...");
        }
    }


}
